package edu.whut.mall.pojo.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import edu.whut.mall.common.enums.TradeType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * Author: smq
 * Unit: D9lab
 * Date: 2021-06-07 16:15
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Trade implements Serializable {
    private static final long serialVersionUID = 14;

    //自动返回id的值
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private Integer user;
    //收件人姓名
    private String name;
    //收件人电话
    private String phone;
    //收件人地址
    private String address;
    private String subOrderNumber;
    private Double totalMoney;
    private Double originalTotalMoney;
    private String tradeHash;
    private Boolean isDeleted;
    private Date createTime;
    private Date updateTime;
    private Date payTime;
    private Integer customerPickUp;
    private Integer activity;
    private TradeType tradeType;
    private Integer payType;

    public Trade(int user, String name, String phone, String address, String subOrderNumber, Double totalMoney, String tradeHash, boolean isDeleted, Date createTime) {
        this.user = user;
        this.name = name;
        this.phone = phone;
        this.address = address;
        this.subOrderNumber = subOrderNumber;
        this.totalMoney = totalMoney;
        this.tradeHash = tradeHash;
        this.isDeleted = isDeleted;
        this.createTime = createTime;
        this.tradeType = TradeType.正常;
    }

    public Trade(Integer user, String name, String phone, String address, String subOrderNumber, Double totalMoney, Double originalTotalMoney, String tradeHash, boolean isDeleted, Date createTime) {
        this.user = user;
        this.name = name;
        this.phone = phone;
        this.address = address;
        this.subOrderNumber = subOrderNumber;
        this.originalTotalMoney = originalTotalMoney;
        this.totalMoney = totalMoney;
        this.tradeHash = tradeHash;
        this.isDeleted = isDeleted;
        this.createTime = createTime;
        this.tradeType = TradeType.正常;
    }

    public Trade(Integer user, String name, String phone, String address, String subOrderNumber, Double totalMoney, Double originalTotalMoney,
                 String tradeHash, Boolean isDeleted, Date createTime, Integer customerPickUp) {
        this.user = user;
        this.name = name;
        this.phone = phone;
        this.address = address;
        this.subOrderNumber = subOrderNumber;
        this.originalTotalMoney = originalTotalMoney;
        this.totalMoney = totalMoney;
        this.tradeHash = tradeHash;
        this.isDeleted = isDeleted;
        this.createTime = createTime;
        this.customerPickUp = customerPickUp;
        this.tradeType = TradeType.正常;
    }

    public Trade(Integer id, Integer user, String name, String subOrderNumber, Double totalMoney, String tradeHash, boolean isDeleted, Date createTime) {
        this.id = id;
        this.user = user;
        this.name = name;
        this.subOrderNumber = subOrderNumber;
        this.totalMoney = totalMoney;
        this.tradeHash = tradeHash;
        this.isDeleted = isDeleted;
        this.createTime = createTime;
        this.tradeType = TradeType.正常;
    }

    public Trade(int tradeId ,Double totalMoney, Double originalTotalMoney) {
        this.id = tradeId;
        this.totalMoney = totalMoney;
        this.originalTotalMoney = originalTotalMoney;
        this.tradeType = TradeType.正常;
    }

    public Trade(int tradeId ,Double totalMoney) {
        this.id = tradeId;
        this.totalMoney = totalMoney;
        this.tradeType = TradeType.正常;
        this.updateTime = new Date();
    }

}
